package model;

public class Transition {

	private final State from;
	private final State to;
	private final char input;
	private final char output;

	/**
	 * Constructor of {@link Transition}.
	 * @param from is the from {@link State}.
	 * @param to is the to {@link State}.
	 * @param input is the char input.
	 * @param output is the char output.
	 */
	public Transition(final State from, final State to, final char input, final char output) {
		this.from = from;
		this.to = to;
		this.input = input;
		this.output = output;
	}

	public State getFrom() {
		return from;
	}

	public State getTo() {
		return to;
	}

	public char getInput() {
		return input;
	}

	public char getOutput() {
		return output;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + from.hashCode();
		result = prime * result + input;
		result = prime * result + output;
		result = prime * result + to.hashCode();
		return result;
	}

	@Override
	public boolean equals(final Object obj) {
		if (this == obj)
			return true;
		if (getClass() != obj.getClass())
			return false;
		final Transition other = (Transition) obj;
		if (!from.equals(other.from))
			return false;
		if (input != other.input)
			return false;
		if (output != other.output)
			return false;
		if (!to.equals(other.to))
			return false;
		return true;
	}

	
}
